Ext.require([ 
    'Ext.grid.*', 
    'Ext.toolbar.Paging', 
    'Ext.util.*', 
    'Ext.data.*'  
]);  
Ext.onReady(function(){
	//tab1的model
    Ext.define('MyData',{
        extend: 'Ext.data.Model',
        fields: [
        	{name:"stCode"},
        	{name:"value1"},
        	{name:"value2"},
        	{name:"value3"},
		    {name:"value4"},
		    {name:"dataTime"},
		    {name:"batteryVoltage"},
		    {name:"temperature"},
		    {name:"relativeHumidity"},
		    {name:"state"}
    	]
	});

	//tab2 List变电站实时数据model
	Ext.define('BdzRealTimeListModel',{
		extend: 'Ext.data.Model',
		fields: [
			{name:"bdzCode"},
			{name:"bdzName"},
			{name:"mesure"},
			{name:"mesure2"},
			{name:"temperature"},
			{name:"humidity"},
			{name:"dataTime"},
			{name:"isMesureValid"},
			{name:"isMesure2Valid"},
			{name:"batteryvalue"},
			{name:"state"}
		]
	});

	//tab1的store
	var store = Ext.create('Ext.data.Store', {
		model: 'MyData',
		remoteSort:true,
		proxy: {
		   // 异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
			type: 'ajax',
			url: path+'/sssj/sssj/hs_getsssjByCond.action',
			reader: {
				type: 'json',
				root: 'root'
			}
		},
		autoLoad: true
	});
	
	var store_bdz_common = Ext.create('Ext.data.Store', {
		model: 'BdzRealTimeListModel',
		remoteSort:true,
		proxy: {
			// 异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
			type: 'ajax',
			url: path+'/bdzRealTimeData/bdzRealTimeData/getRealTimeListByCond.action',
			reader: {
				type: 'json',
				root: 'root'
			}
		},
		autoLoad: false
	});



	//tab1右上角统计图表
	var options = {
		chart:{
			renderTo:'container',
			//将报表对象渲染到层上
			defaultSeriesType:'spline',
			width:700,
			height:340
		},
		title: {
			text: '市民之家电磁环境在线监测示范点实时数据',
			style:{
				fontSize: '20px',
				fontWeight:'bold'
			}
		},
		xAxis: {labels: {
			enabled: false// Highcharts学习交流群294191384
		}},
		yAxis: {
			title: {
				text: '数值'
			},
			plotLines: [{
				value: 0,
				width: 1,
				color: '#808080'
			}]
		},
		series: []
	};

	var options_1 = {
		chart:{
			renderTo:'container_1',
			//将报表对象渲染到层上
			defaultSeriesType:'spline',
			width:700,
			height:340
		},
		title: {
			text: '蔡家嘴变电站电磁环境在线监测示范点实时数据',
			style:{
				fontSize: '20px',
				fontWeight:'bold'
			}
		},
		xAxis: {labels: {
			enabled: false// Highcharts学习交流群294191384
		}},
		yAxis: {
			title: {
				text: '数值'
			},
			plotLines: [{
				value: 0,
				width: 1,
				color: '#808080'
			}]
		},
		series: []
	};

	var options_2 = {
		chart:{
			renderTo:'container_2',
			//将报表对象渲染到层上
			defaultSeriesType:'spline',
			width:700,
			height:340
		},
		title: {
			text: '沈阳路变电站电磁环境在线监测示范点实时数据',
			style:{
				fontSize: '20px',
				fontWeight:'bold'
			}
		},
		xAxis: {labels: {
			enabled: false// Highcharts学习交流群294191384
		}},
		yAxis: {
			title: {
				text: '数值'
			},
			plotLines: [{
				value: 0,
				width: 1,
				color: '#808080'
			}]
		},
		series: []
	};

	var options_3 = {
		chart:{
			renderTo:'container_3',
			//将报表对象渲染到层上
			defaultSeriesType:'spline',
			width:700,
			height:340
		},
		title: {
			text: '紫阳湖变电站电磁环境在线监测示范点实时数据',
			style:{
				fontSize: '20px',
				fontWeight:'bold'
			}
		},
		xAxis: {labels: {
			enabled: false// Highcharts学习交流群294191384
		}},
		yAxis: {
			title: {
				text: '数值'
			},
			plotLines: [{
				value: 0,
				width: 1,
				color: '#808080'
			}]
		},
		series: []
	};

	var options_4 = {
		chart:{
			renderTo:'container_4',
			//将报表对象渲染到层上
			defaultSeriesType:'spline',
			width:700,
			height:340
		},
		title: {
			text: '宗关变电站电磁环境在线监测示范点实时数据',
			style:{
				fontSize: '20px',
				fontWeight:'bold'
			}
		},
		xAxis: {labels: {
			enabled: false// Highcharts学习交流群294191384
		}},
		yAxis: {
			title: {
				text: '数值'
			},
			plotLines: [{
				value: 0,
				width: 1,
				color: '#808080'
			}]
		},
		series: []
	};

	//tab1中的右下角表格
	var sssj_grid = Ext.create('Ext.grid.Panel',{
		id:'sssj_grid',
		columnLines: true,
		border: false,
		forceFit : true,
		store: store,
		columns: [
			{text:"时间",dataIndex:"dataTime", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"电场强度(V/m)",dataIndex:"value1", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"GMS900(V/m)",dataIndex:"value2", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"GMS1800(V/m)",dataIndex:"value3", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"UMTS 3G(V/m)",dataIndex:"value4", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"温度(℃)",dataIndex:"batteryVoltage", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"相对湿度(%)",dataIndex:"temperature", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"状态",dataIndex:"state", sortable: false,
				renderer:function(value){
					if(value=="1"){
						return "正常";
					}else{
						return "异常";
					}
				}
			}
		],
		viewConfig: {
			stripeRows: true
		}
	});

	var sssj_grid1 = Ext.create('Ext.grid.Panel',{
		id:'sssj_grid1',
		columnLines: true,
		border: false,
		forceFit : true,
		store: store_bdz_common,
		columns: [
			{text:"时间",dataIndex:"dataTime", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
						//如果实体中是Date类型，可以用这种方式转化
						//return Ext.util.Format.date(new Date(value),'Y-m-d H:i:s');
					}
				}
			},
			{text:"变电站名称",dataIndex:"bdzName", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频电场(V/m)",dataIndex:"mesure", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"电场是否达标",dataIndex:"isMesureValid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频磁场(μT)",dataIndex:"mesure2", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"磁场是否达标",dataIndex:"isMesure2Valid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点温度(℃)",dataIndex:"temperature", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点湿度(%)",dataIndex:"humidity", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},{text:"电池电压(V)",dataIndex:"batteryvalue", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"状态",dataIndex:"state", sortable: false,
				renderer:function(value){
					if(value=="1"){
						return "正常";
					}else{
						return "异常";
					}
				}
			}
		],
		viewConfig: {
			stripeRows: true
		}
	});

	var sssj_grid2 = Ext.create('Ext.grid.Panel',{
		id:'sssj_grid2',
		columnLines: true,
		border: false,
		forceFit : true,
		store: store_bdz_common,
		columns: [
			{text:"时间",dataIndex:"dataTime", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
						//return Ext.util.Format.date(new Date(value),'Y-m-d H:i:s');
					}
				}
			},
			{text:"变电站名称",dataIndex:"bdzName", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频电场(V/m)",dataIndex:"mesure", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"电场是否达标",dataIndex:"isMesureValid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频磁场(μT)",dataIndex:"mesure2", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"磁场是否达标",dataIndex:"isMesure2Valid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点温度(℃)",dataIndex:"temperature", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点湿度(%)",dataIndex:"humidity", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},{text:"电池电压(V)",dataIndex:"batteryvalue", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"状态",dataIndex:"state", sortable: false,
				renderer:function(value){
					if(value=="1"){
						return "正常";
					}else{
						return "异常";
					}
				}
			}
		],
		viewConfig: {
			stripeRows: true
		}
	});

	var sssj_grid3 = Ext.create('Ext.grid.Panel',{
		id:'sssj_grid3',
		columnLines: true,
		border: false,
		forceFit : true,
		store: store_bdz_common,
		columns: [
			{text:"时间",dataIndex:"dataTime", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
						//return Ext.util.Format.date(new Date(value),'Y-m-d H:i:s');
					}
				}
			},
			{text:"变电站名称",dataIndex:"bdzName", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频电场(V/m)",dataIndex:"mesure", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"电场是否达标",dataIndex:"isMesureValid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频磁场(μT)",dataIndex:"mesure2", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"磁场是否达标",dataIndex:"isMesure2Valid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点温度(℃)",dataIndex:"temperature", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点湿度(%)",dataIndex:"humidity", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"电池电压(V)",dataIndex:"batteryvalue", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"状态",dataIndex:"state", sortable: false,
				renderer:function(value){
					if(value=="1"){
						return "正常";
					}else{
						return "异常";
					}
				}
			}
		],
		viewConfig: {
			stripeRows: true
		}
	});

	var sssj_grid4 = Ext.create('Ext.grid.Panel',{
		id:'sssj_grid4',
		columnLines: true,
		border: false,
		forceFit : true,
		store: store_bdz_common,
		columns: [
			{text:"时间",dataIndex:"dataTime", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
						// return Ext.util.Format.date(new Date(value),'Y-m-d H:i:s');
					}
				}
			},
			{text:"变电站名称",dataIndex:"bdzName", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频电场(V/m)",dataIndex:"mesure", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"电场是否达标",dataIndex:"isMesureValid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"工频磁场(μT)",dataIndex:"mesure2", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"磁场是否达标",dataIndex:"isMesure2Valid", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点温度(℃)",dataIndex:"temperature", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"站点湿度(%)",dataIndex:"humidity", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"电池电压(V)",dataIndex:"batteryvalue", sortable: false,
				renderer:function(value){
					if(value==null||value=="null"){
						return "";
					}else{
						return value;
					}
				}
			},
			{text:"状态",dataIndex:"state", sortable: false,
				renderer:function(value){
					if(value=="1"){
						return "正常";
					}else{
						return "异常";
					}
				}
			}
		],
		viewConfig: {
			stripeRows: true
		}
	});

	//tab1的主面板
	var jzsb_panel =new Ext.panel.Panel({
		layout: 'border',
		items: [
			{
				region: 'west',
				xtype:"form",
				id:"jbxx",
				width: 300,
				defaultType:"displayfield",
				border:false,
				items:[
						{
							fieldLabel:"设备名称",
							name:"JZ_SB_MC",
							id:"JZ_SB_MC"
						},{
							 fieldLabel: "安装位置",
							 name:"JZ_SB_AZWZ",
							 id:"JZ_SB_AZWZ"
						},{
							fieldLabel: "启用时间",
							name:"JZ_SB_QYSJ",
							id:"JZ_SB_QYSJ"
						}, {
							fieldLabel:"运营商信息",
							name:"JZ_YYS_XX",
							id:"JZ_YYS_XX"
						},{
							fieldLabel:"环评状态",
							name:"JZ_HP_ZT",
							id:"JZ_HP_ZT"
						}, {
							fieldLabel: "天线架设方式 ",
							name:"JZ_FSTX_JSFS",
							id:"JZ_FSTX_JSFS"
						}, {
							fieldLabel:"环评检测单位",
							name:"JZ_JC_DW",
							id:"JZ_JC_DW"
						},{
							fieldLabel:"环评批复单位",
							name:"JZ_YS_DW",
							id:"JZ_YS_DW"
						}, {
							fieldLabel: "敏感点信息描述",
							name:"JZ_BZ",
							id:"JZ_BZ"
						},
						{
							xtype: 'panel',
							id:'tpxx',
							border:false,
							/*id=demo3的div元素，即图片列表
							在组件渲染以后才加入这个元素
							 */
							contentEl:'demo3'
						}
					]
		//      	collapsible: true// 可折叠/展开
			}, {
				//title: 'Center Region (必须)',
				region: 'center',     // 必须指定中间区域
				xtype: 'form',
				autoScroll : true,
				items:[
					{
						xtype: 'panel',
						contentEl:'container'//统计图表，绑定container元素
					},{
						xtype: 'panel',
						layout:'fit',
						//title: 'South Region (可调整大小)',
						//collapsible: true,   // 可折叠/展开
						items: sssj_grid
					}]
		}
		]
	});

	var jzsb_panel1 =new Ext.panel.Panel({
		layout: 'border',
		items: [
			{
				region: 'west',
				xtype:"form",
				id:"jbxx1",
				width: 300,
				defaultType:"displayfield",
				border:false,
				items:[
					{
						fieldLabel:"设备名称",
						name:"JZ_SB_MC",
						id:"JZ_SB_MC_13MT0227"
					},{
						fieldLabel: "安装位置",
						name:"JZ_SB_AZWZ",
						id:"JZ_SB_AZWZ_13MT0227"
					},{
						fieldLabel: "启用时间",
						name:"JZ_SB_QYSJ",
						id:"JZ_SB_QYSJ_13MT0227"
					},{
						fieldLabel:"环评状态",
						name:"JZ_HP_ZT",
						id:"JZ_HP_ZT_13MT0227"
					},{
						fieldLabel:"环评检测单位",
						name:"JZ_JC_DW",
						id:"JZ_JC_DW_13MT0227"
					},{
						fieldLabel:"环评批复单位",
						name:"JZ_YS_DW",
						id:"JZ_YS_DW_13MT0227"
					}, {
						fieldLabel: "敏感点信息描述",
						name:"JZ_BZ",
						id:"JZ_BZ_13MT0227"
					},
					{
						xtype: 'panel',
						id:'imgpanel_13MT0227',
						border:false,
						/*id=demo3的div元素，即图片列表
						 在组件渲染以后才加入这个元素
						 */
						contentEl:'img_13MT0227'
					}
				]
				//      	collapsible: true// 可折叠/展开
			}, {
				//title: 'Center Region (必须)',
				region: 'center',     // 必须指定中间区域
				xtype: 'form',
				autoScroll : true,
				items:[
					{
						xtype: 'panel',
						contentEl:'container_1'//统计图表，绑定container元素
					},{
						xtype: 'panel',
						layout:'fit',
						//title: 'South Region (可调整大小)',
						//collapsible: true,   // 可折叠/展开
						items: sssj_grid1
					}]
			}
		]
	});

	var jzsb_panel2 =new Ext.panel.Panel({
		layout: 'border',
		items: [
			{
				region: 'west',
				xtype:"form",
				id:"jbxx2",
				width: 300,
				defaultType:"displayfield",
				border:false,
				items:[
					{
						fieldLabel:"设备名称",
						name:"JZ_SB_MC",
						id:"JZ_SB_MC_02715071017_ESM100"
					},{
						fieldLabel: "安装位置",
						name:"JZ_SB_AZWZ",
						id:"JZ_SB_AZWZ_02715071017_ESM100"
					},{
						fieldLabel: "启用时间",
						name:"JZ_SB_QYSJ",
						id:"JZ_SB_QYSJ_02715071017_ESM100"
					},{
						fieldLabel:"环评状态",
						name:"JZ_HP_ZT",
						id:"JZ_HP_ZT_02715071017_ESM100"
					},{
						fieldLabel:"环评检测单位",
						name:"JZ_JC_DW",
						id:"JZ_JC_DW_02715071017_ESM100"
					},{
						fieldLabel:"环评批复单位",
						name:"JZ_YS_DW",
						id:"JZ_YS_DW_02715071017_ESM100"
					}, {
						fieldLabel: "敏感点信息描述",
						name:"JZ_BZ",
						id:"JZ_BZ_02715071017_ESM100"
					},
					{
						xtype: 'panel',
						id:'imgpanel_02715071017_ESM100',
						border:false,
						/*id=demo3的div元素，即图片列表
						 在组件渲染以后才加入这个元素
						 */
						contentEl:'img_02715071017_ESM100'
					}
				]
				//      	collapsible: true// 可折叠/展开
			}, {
				//title: 'Center Region (必须)',
				region: 'center',     // 必须指定中间区域
				xtype: 'form',
				autoScroll : true,
				items:[
					{
						xtype: 'panel',
						contentEl:'container_2'//统计图表，绑定container元素
					},{
						xtype: 'panel',
						layout:'fit',
						//title: 'South Region (可调整大小)',
						//collapsible: true,   // 可折叠/展开
						items: sssj_grid2
					}]
			}
		]
	});

	var jzsb_panel3 =new Ext.panel.Panel({
		layout: 'border',
		items: [
			{
				region: 'west',
				xtype:"form",
				id:"jbxx3",
				width: 300,
				defaultType:"displayfield",
				border:false,
				items:[
					{
						fieldLabel:"设备名称",
						name:"JZ_SB_MC",
						id:"JZ_SB_MC_02715071015_ESM100"
					},{
						fieldLabel: "安装位置",
						name:"JZ_SB_AZWZ",
						id:"JZ_SB_AZWZ_02715071015_ESM100"
					},{
						fieldLabel: "启用时间",
						name:"JZ_SB_QYSJ",
						id:"JZ_SB_QYSJ_02715071015_ESM100"
					},{
						fieldLabel:"环评状态",
						name:"JZ_HP_ZT",
						id:"JZ_HP_ZT_02715071015_ESM100"
					},{
						fieldLabel:"环评检测单位",
						name:"JZ_JC_DW",
						id:"JZ_JC_DW_02715071015_ESM100"
					},{
						fieldLabel:"环评批复单位",
						name:"JZ_YS_DW",
						id:"JZ_YS_DW_02715071015_ESM100"
					}, {
						fieldLabel: "敏感点信息描述",
						name:"JZ_BZ",
						id:"JZ_BZ_02715071015_ESM100"
					},
					{
						xtype: 'panel',
						id:'imgpanel_02715071015_ESM100',
						border:false,
						/*id=demo3的div元素，即图片列表
						 在组件渲染以后才加入这个元素
						 */
						contentEl:'img_02715071015_ESM100'
					}
				]
				//      	collapsible: true// 可折叠/展开
			}, {
				//title: 'Center Region (必须)',
				region: 'center',     // 必须指定中间区域
				xtype: 'form',
				autoScroll : true,
				items:[
					{
						xtype: 'panel',
						contentEl:'container_3'//统计图表，绑定container元素
					},{
						xtype: 'panel',
						layout:'fit',
						//title: 'South Region (可调整大小)',
						//collapsible: true,   // 可折叠/展开
						items: sssj_grid3
					}]
			}
		]
	});

	var jzsb_panel4 =new Ext.panel.Panel({
		layout: 'border',
		items: [
			{
				region: 'west',
				xtype:"form",
				id:"jbxx4",
				width: 300,
				defaultType:"displayfield",
				border:false,
				items:[
					{
						fieldLabel:"设备名称",
						name:"JZ_SB_MC",
						id:"JZ_SB_MC_02715071016_ESM100"
					},{
						fieldLabel: "安装位置",
						name:"JZ_SB_AZWZ",
						id:"JZ_SB_AZWZ_02715071016_ESM100"
					},{
						fieldLabel: "启用时间",
						name:"JZ_SB_QYSJ",
						id:"JZ_SB_QYSJ_02715071016_ESM100"
					},{
						fieldLabel:"环评状态",
						name:"JZ_HP_ZT",
						id:"JZ_HP_ZT_02715071016_ESM100"
					},{
						fieldLabel:"环评检测单位",
						name:"JZ_JC_DW",
						id:"JZ_JC_DW_02715071016_ESM100"
					},{
						fieldLabel:"环评批复单位",
						name:"JZ_YS_DW",
						id:"JZ_YS_DW_02715071016_ESM100"
					}, {
						fieldLabel: "敏感点信息描述",
						name:"JZ_BZ",
						id:"JZ_BZ_02715071016_ESM100"
					},
					{
						xtype: 'panel',
						id:'imgpanel_02715071016_ESM100',
						border:false,
						/*id=demo3的div元素，即图片列表
						 在组件渲染以后才加入这个元素
						 */
						contentEl:'img_02715071016_ESM100'
					}
				]
				//      	collapsible: true// 可折叠/展开
			}, {
				//title: 'Center Region (必须)',
				region: 'center',     // 必须指定中间区域
				xtype: 'form',
				autoScroll : true,
				items:[
					{
						xtype: 'panel',
						contentEl:'container_4'//统计图表，绑定container元素
					},{
						xtype: 'panel',
						layout:'fit',
						//title: 'South Region (可调整大小)',
						//collapsible: true,   // 可折叠/展开
						items: sssj_grid4
					}]
			}
		]
	});




	//tab2 list store
	var bdzStore = Ext.create('Ext.data.Store', {
		model: 'BdzRealTimeListModel',
		remoteSort:true,
		proxy: {
			// 异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
			type: 'ajax',
			url: path+'/bdzRealTimeData/bdzRealTimeData/getRealTimeList.action',
			reader: {
				type: 'json',
				root: 'root'
			}
		},
		autoLoad: true
	});

	//tab2 detail store
	var store2 = Ext.create('Ext.data.Store', {
		model: 'MyData',
		remoteSort:true,
		proxy: {
			// 异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
			type: 'ajax',
			url: path+'/sssj/sssj/hs_getsssjByCond.action',
			reader: {
				type: 'json',
				root: 'root'
			}
		},
		autoLoad: true
	});

	//tab2 detail 右上角统计图表
	var options2 = {
		chart:{
			renderTo:'container2',
			//将报表对象渲染到层上
			defaultSeriesType:'spline',
			width:700,
			height:340
		},
		title: {
			text: '市民之家电磁环境在线监测示范点实时数据detail',
			style:{
				fontSize: '20px',
				fontWeight:'bold'
			}
		},
		xAxis: {labels: {
			enabled: false// Highcharts学习交流群294191384
		}},
		yAxis: {
			title: {
				text: '数值'
			},
			plotLines: [{
				value: 0,
				width: 1,
				color: '#808080'
			}]
		},
		series: []
	};

	//tab2 list 主面板
	Ext.define('HT.view.GridList',{
		extend:'Ext.grid.Panel',
		initComponent:function(){
			Ext.apply(this,{
				columnLines: true,
				border: false,
				forceFit : true,
				store: bdzStore,
				columns: [
					{text:"时间",dataIndex:"dataTime", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
								//return Ext.util.Format.date(new Date(value),'Y-m-d H:i:s');
							}
						}
					},
					{text:"变电站名称",dataIndex:"bdzName", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
							}
						}
					},
					{text:"工频电场(V/m)",dataIndex:"mesure", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
							}
						}
					},
					{text:"电场是否达标",dataIndex:"isMesureValid", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
							}
						}
					},
					{text:"工频磁场(μT)",dataIndex:"mesure2", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
							}
						}
					},
					{text:"磁场是否达标",dataIndex:"isMesure2Valid", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
							}
						}
					},
					{text:"站点温度(℃)",dataIndex:"temperature", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
							}
						}
					},
					{text:"站点湿度(%)",dataIndex:"humidity", sortable: false,
						renderer:function(value){
							if(value==null||value=="null"){
								return "";
							}else{
								return value;
							}
						}
					},
					{text:"状态",dataIndex:"state", sortable: false,
						renderer:function(value){
							if(value=="1"){
								return "正常";
							}else{
								return "异常";
							}
						}
					}
				],
				viewConfig: {
					stripeRows: true
				}
			});
			this.callParent(arguments);
		}
	});

	var tabpanel = Ext.create('Ext.tab.Panel', {
		resizable:false,
		closable:false,
		activeTab: 0,     // 初始打开第一个标签页
		modal:true,
		items:[
			{
				xtype:'panel',
				id:'tab1',
				title:'基站设备',
				border:false,
				items: jzsb_panel,
				layout:'fit',
				listeners:{
					//在原js中,用于在panel渲染完以后加载数据,请求轮播的图片
					afterrender:function(view, eOpts ){
						getJzsbBaseInfo();
						getChart();
					}
				}
			},
			{
				xtype:"panel",
				id:'tab2',
				title:"变电站设备",
				items: Ext.create('HT.view.GridList'),
				layout:'fit'
			},{
				xtype:'panel',
				id:'13MT0227',
				title:'蔡家嘴变电站',
				border:false,
				items: jzsb_panel1,
				layout:'fit',
				listeners:{
					//在原js中,用于在panel渲染完以后加载数据,请求轮播的图片
					afterrender:function(view, eOpts ){
						loadDataByBdzCode(view.getId());
						getBdzBaseInfo(view.getId());
					}
				}
			},{
				xtype:'panel',
				id:'02715071017_ESM100',
				title:'沈阳路变电站',
				border:false,
				items: jzsb_panel2,
				layout:'fit',
				listeners:{
					//在原js中,用于在panel渲染完以后加载数据,请求轮播的图片
					afterrender:function(view, eOpts ){
						loadDataByBdzCode(view.getId());
						getBdzBaseInfo(view.getId());
					}
				}
			},{
				xtype:'panel',
				id:'02715071015_ESM100',
				title:'紫阳湖变电站',
				border:false,
				items: jzsb_panel3,
				layout:'fit',
				listeners:{
					//在原js中,用于在panel渲染完以后加载数据,请求轮播的图片
					afterrender:function(view, eOpts ){
						loadDataByBdzCode(view.getId());
						getBdzBaseInfo(view.getId());
					}
				}
			},{
				xtype:'panel',
				id:'02715071016_ESM100',
				title:'宗关变电站',
				border:false,
				items: jzsb_panel4,
				layout:'fit',
				listeners:{
					//在原js中,用于在panel渲染完以后加载数据,请求轮播的图片
					afterrender:function(view, eOpts ){
						loadDataByBdzCode(view.getId());
						getBdzBaseInfo(view.getId());
					}
				}
			}],
		listeners:{
			'tabchange':function(tabPanel, newTab, oldCard, eOpts){
				var newTabId = newTab.getId();
				if("13MT0227"==newTabId || '02715071017_ESM100'==newTabId ||
					"02715071015_ESM100"==newTabId || "02715071016_ESM100"==newTabId){
					loadDataByBdzCode(newTabId);
				}else{
				}
			}
		}
	});


	//显示
	Ext.create('Ext.Viewport', {
			layout:'fit',
			items: tabpanel
	});

	//基站设备中的定时任务
	setInterval(jzsbTimeTask,60000);
	//变电站的定时任务
	setInterval(bdzTimeTask,30000);


	function jzsbTimeTask(){
		var activeTabId = tabpanel.getActiveTab().id;
		//只有当激活的是指定标签页时，才刷新数据
		if('tab1'==activeTabId) {
			store.load();
			getChart();
		}else if('13MT0227'==activeTabId){
			loadDataByBdzCode(activeTabId);
		}else if('02715071017_ESM100'==activeTabId){
			loadDataByBdzCode(activeTabId);
		}else if('02715071015_ESM100'==activeTabId){
			loadDataByBdzCode(activeTabId);
		}else if('02715071016_ESM100'==activeTabId){
			loadDataByBdzCode(activeTabId);
		}else{
		}
	};

	function getBdzBaseInfo(bdzCode) {
		//var bdzCode = '13MT0227';//'EP-4B-02'
		var imgElementId = 'img_'+bdzCode;
		var panelId = 'imgpanel_'+bdzCode;//左下角的panel的ID，用来装img元素
		var _bdzCode = '_'+bdzCode;
		Ext.Ajax.request({
			url: '${webctx }/gis_getJzsbJbxx.action',
			method: 'POST',
			async:false,
			params: { 'dcfsJzSbJbxx.jzsbbh': bdzCode },
			callback: function (object, bool, response){
				Ext.getCmp("JZ_SB_MC"+_bdzCode).setValue(response.responseText.split(":'")[2].split("',")[0]);
				Ext.getCmp("JZ_SB_AZWZ"+_bdzCode).setValue(response.responseText.split(":'")[7].split("',")[0]);
				Ext.getCmp("JZ_SB_QYSJ"+_bdzCode).setValue(response.responseText.split(":'")[8].split("',")[0]);
				Ext.getCmp("JZ_BZ"+_bdzCode).setValue(response.responseText.split(":'")[23].split("',")[0]);
				Ext.getCmp("JZ_HP_ZT"+_bdzCode).setValue(response.responseText.split(":'")[29].split("',")[0]);
				Ext.getCmp("JZ_YS_DW"+_bdzCode).setValue(response.responseText.split(":'")[30].split("',")[0]);
				Ext.getCmp("JZ_JC_DW"+_bdzCode).setValue(response.responseText.split(":'")[32].split("',")[0]);
			},
			failure: function (response) {
				Ext.Msg.alert("提示", "加载失败");
			}
		});
		//tpxx为左下角的panel，用来装img元素
		var height=(document.getElementById(panelId).offsetHeight-30)+"px";
		if(navigator.appName.indexOf("Microsoft")!=-1){
			if(Number(navigator.userAgent.substring(29,33))<9){
				height=(document.getElementById(panelId).offsetHeight-35)+"px";
			}
		}
		Ext.Ajax.request({
			url: '${webctx}/doc_getDcfsDocmentListByCond.action',
			method: 'POST',
			async:false,
			params: {'dcfsDocument.jzsbbh':bdzCode,'dcfsDocument.doctype':'图片'},
			callback: function (object, bool, response) {
				var jzsb_result=eval(response.responseText);
				var html='<ul class="items">';
				var str;
				for(var i=0;i<jzsb_result.length;i++){
					str=jzsb_result[i].docurl.split("\\");
					html+="<li><img src='/doc/"+str[str.length-1]+"' width='300px' height='"+height+"'/></li>";
				}
				//取得页面中的id=demo3的div元素，添加图片ul进去
				document.getElementById(imgElementId).innerHTML=html+"</ul>";
				$('#'+imgElementId).slideBox({
					duration : 0.5,//滚动持续时间，单位：秒
					easing : 'linear',//swing,linear//滚动特效
					delay : 5,//滚动延迟时间，单位：秒
					hideClickBar : false,//不自动隐藏点选按键
					clickBarRadius :10
				});
			}
		});
	}

	function loadDataByBdzCode(bdzCode) {
		var options;
		if('13MT0227'==bdzCode){
			options = options_1;
		}else if('02715071017_ESM100'==bdzCode){
			options = options_2;
		}else if('02715071015_ESM100'==bdzCode){
			options = options_3;
		}else if('02715071016_ESM100'==bdzCode){
			options = options_4;
		}else{
			return;
		}
		store_bdz_common.load({params  : {
			bdzCode : bdzCode
		}});
		Ext.Ajax.request({
			url: path+'/bdzRealTimeData/bdzRealTimeData/getsssjData.action',
			async:false,
			params: { 'bdzCode': bdzCode },
			success:function(response) {
				var json= eval("("+response.responseText+")");
				options.series =json.storeY;
				options.xAxis =json.storeX;
				new Highcharts.Chart(options);
			},
			failure:function() {
				Ext.Msg.alert("提示","加载出现异常了！");
			}
		});
	}

	function getChart(){
		Ext.Ajax.request({
			url: path+'/sssj/sssj/hs_getsssjData.action',
			async:false,
			success:function(response) {
				var json= eval("("+response.responseText+")");
				options.series =json.storeY;
				options.xAxis =json.storeX;
				new Highcharts.Chart(options);
			},
			failure:function() {
				Ext.Msg.alert("提示","加载出现异常了！");
			}
		});
	}

	function getJzsbBaseInfo() {
		Ext.Ajax.request({
			url: '${webctx }/gis_getJzsbJbxx.action',
			method: 'POST',
			async:false,
			params: { 'dcfsJzSbJbxx.jzsbbh':'EP-4B-02' },
			callback: function (object, bool, response){
				Ext.getCmp("JZ_SB_MC").setValue(response.responseText.split(":'")[2].split("',")[0]);
				Ext.getCmp("JZ_SB_AZWZ").setValue(response.responseText.split(":'")[7].split("',")[0]);
				Ext.getCmp("JZ_SB_QYSJ").setValue(response.responseText.split(":'")[8].split("',")[0]);
				Ext.getCmp("JZ_FSTX_JSFS").setValue(response.responseText.split(":'")[20].split("',")[0]);
				Ext.getCmp("JZ_BZ").setValue(response.responseText.split(":'")[23].split("',")[0]);
				Ext.getCmp("JZ_HP_ZT").setValue(response.responseText.split(":'")[29].split("',")[0]);
				Ext.getCmp("JZ_YS_DW").setValue(response.responseText.split(":'")[30].split("',")[0]);
				Ext.getCmp("JZ_YYS_XX").setValue(response.responseText.split(":'")[31].split("',")[0]);
				Ext.getCmp("JZ_JC_DW").setValue(response.responseText.split(":'")[32].split("',")[0]);
			},
			failure: function (response) {
				Ext.Msg.alert("提示", "加载失败");
			}
		});
		//tpxx为左下角的panel，用来装demo3元素
		var height=(document.getElementById('tpxx').offsetHeight-30)+"px";
		if(navigator.appName.indexOf("Microsoft")!=-1){
			if(Number(navigator.userAgent.substring(29,33))<9){
				height=(document.getElementById('tpxx').offsetHeight-35)+"px";
			}
		}
		Ext.Ajax.request({
			url: '${webctx}/doc_getDcfsDocmentListByCond.action',
			method: 'POST',
			async:false,
			params: {'dcfsDocument.jzsbbh':'EP-4B-02','dcfsDocument.doctype':'图片'},
			callback: function (object, bool, response) {
				var jzsb_result=eval(response.responseText);
				var html='<ul class="items">';
				var str;
				for(var i=0;i<jzsb_result.length;i++){
					str=jzsb_result[i].docurl.split("\\");
					html+="<li><img src='/doc/"+str[str.length-1]+"' width='300px' height='"+height+"'/></li>";
				}
				//取得页面中的id=demo3的div元素，添加图片ul进去
				document.getElementById("demo3").innerHTML=html+"</ul>";
				$('#demo3').slideBox({
					duration : 0.5,//滚动持续时间，单位：秒
					easing : 'linear',//swing,linear//滚动特效
					delay : 5,//滚动延迟时间，单位：秒
					hideClickBar : false,//不自动隐藏点选按键
					clickBarRadius :10
				});
			}
		});
	}

	//变电站标签页
	function bdzTimeTask() {
		var activeTabId = tabpanel.getActiveTab().id;
		if('tab2'==activeTabId) {
			bdzStore.load();
		}
	}

});